// 人： 图片 背景 名字
import G6 from "@antv/g6";

G6.registerNode('person-node', {
        afterDraw(cfg, group) {
            // console.log(group)
            const size = cfg.size;
            const width = size[0];
            const height = size[1];
            // 添加图片
            group.addShape('image', {
                attrs: {
                    x: -width / 2,
                    y: -height / 2,
                    width: width,
                    height: height,
                    img: cfg.img,
                    cursor: 'pointer'
                },
                draggable: true, // 重要,使得节点可以被拖动
                // must be assigned in G6 3.3 and later versions. it can be any value you want
                name: 'image-shape'
            });
        }
    },
    // 继承了 rect 节点
    'rect');